package com.carsys.service.Impl;

import com.carsys.entity.Car;
import com.carsys.mapper.CarMapper;
import com.carsys.service.CarService;
import com.carsys.vo.VCar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarServiceImpl implements CarService {
    @Autowired
    private CarMapper carMapper;

    @Override
    public boolean addCar(Car car) {
        return carMapper.insertCar(car)>0;
    }
    @Override
    public List<Car> findCarPrice(int getid) {
        return carMapper.findCarPrice(getid);
    }

    @Override
    public List<Car> findCarNumber(int getid) {
        return carMapper.findCarNumber(getid);
    }

    @Override
    public Car findCarById(int getid) {
        return carMapper.selectCarById(getid);
    }

    public List<VCar> findCars() {
        return carMapper.findCars();
    }

    @Override
    public boolean delteOrders(int id) {
        try{
            carMapper.delteOrders(id);
            return true;
        }catch (Exception e){
            return false;
        }

    }

    @Override
    public VCar findCarInfoById(int id) {

        return carMapper.findCarInfoById(id);
    }

    @Override
    public void updataCar(VCar cars) {
         carMapper.updataCar(cars);
    }
}
